home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Carousel
/
CAROUSEL.cdr
/
mactosh
/
code
/
p_serlib.sit
/
Serial Library Source Code
/
serial.charArrived.dll.c
< prev
next >
Wrap
C/C++ Source or Header
|
1989-07-27
|
2KB
|
81 lines
/***********************************************************************/
/*
/* serial.charArrived.dll.c
/* by Atul Butte
/* Copyright ⌐ 1989 by Microsoft Corporation
/* All Rights Reserved
/*
/* version 1.0
/*
/*
/* This CALL/REGISTER returns true if there are characters waiting
/* in the buffer.
/*
/* Excel usage:
/*
/* = Register( "serial library", "serial.charArrived", "AH" )
/* = Call( ref, portNumber )
/*
/* where
/* portNumber = number of port (1 = modem, 2 = printer)
/*
/***********************************************************************/
/***********************************************************************/
/*
/* D E F I N E S
/*
/***********************************************************************/
#define ROUTINE_NAME "serial.charArrived"
#define hNIL 0L
#define pNIL 0L
/***********************************************************************/
/*
/* I N C L U D E S
/*
/***********************************************************************/
#include "serial.h"
#include "error.h"
#include "get_port.h"
/***********************************************************************/
/*
/* main
/*
/***********************************************************************/
pascal Boolean main( port )
unsigned short port; /* serial port to use */
{
register OSErr err; /* result code from Toolbox routines */
short refIn; /* reference number for input port */
short refOut; /* reference number for output port */
long cch; /* count of characters in buffer */
RememberA0( );
SetUpA4( );
err = get_port( port, &refIn, &refOut );
if( err != noErr ) {
display_error( "Illegal port number." );
RestoreA4( );
return( err );
}
err = SerGetBuf( refIn, &cch );
if( err != noErr ) {
display_error( "Error trying to count buffer." );
RestoreA4( );
return( false );
}
RestoreA4( );
return( cch > 0 );
}
#include "get_port.c"